home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple Reference & Presen…tion Library 4 (Reseller)
/
Apple Ref. & Pres. Lib.v4.0.iso
/
5-Fonts & Software
/
Demo Software
/
Wingz
/
Scripts
/
ttt
(
.txt
)
< prev
Wrap
Wingz Script
|
1989-02-08
|
20KB
|
568 lines
WNGZWZSC01b1
Helvetica
Bious
Congratulations! You won!
Sorry, Wingz won. Try again!
Congratulations! You won!
Sorry, Wingz won. Try again!
Congratulations! You won!
Sorry, Wingz won. Try again!
Congratulations! You won!
Sorry, Wingz won. Try again!
Congratulations! You won!
Sorry, Wingz won. Try again!
Congratulations! You won!
Sorry, Wingz won. Try again!
Congratulations! You won!
Sorry, Wingz won. Try again!
Congratulations! You won!
Sorry, Wingz won. Try again!
Cat game. Play again.
catwon
player
nmove
flag
catwonp
define player,go,c,r,c1,r1,won,rep,nmove,flag
rep = 0
won = 0
function comp()
won = 0
if player = 0
wait for 2 seconds
put "O" into c7
player = 3
exit function
end if { end of player = 0 }
if nmove = 1
if b6="O" and isblank(c6) and isblank(d6) and b7="X" and c7="O" and isblank(d7)
and isblank(b8) and isblank(c8) and d8="X"
put "O" into d6
nmove = 0
exit function
end if
if isblank(b6) and c6="X" and d6="O" and isblank(b7) and c7="O" and isblank(d7)
and b8="X" and isblank(c8) and isblank(d8)
put "O" into d8
nmove = 0
exit function
end if
if b6="X" and isblank(c6) and isblank(d6) and isblank(b7) and c7="O" and d7="X"
and isblank(b8) and isblank(c8) and d8="O"
put "O" into b8
nmove = 0
exit function
end if
if isblank(b6) and isblank(c6) and d6="X" and isblank(b7) and c7="O" and isblank(d7)
and b8="O" and c8="X" and isblank(d8)
put "O" into b6
nmove = 0
exit function
end if
end if { end of nmove = 1 }
if player <> 0
if isblank(b6) and isblank(c6) and isblank(d6) and isblank(b7) and isblank(d7) and
isblank(b8) and isblank(c8) and isblank(d8) and c7="X"
put "O" into b6
exit function
end if
if b6="X" and isblank(c6) and isblank(d6) and isblank(b7) and isblank(d7) and
isblank(b8) and isblank(c8) and isblank(d8) and isblank(c7)
put "O" into c7
exit function
end if
if isblank(b6) and c6="X" and isblank(d6) and isblank(b7) and isblank(d7) and
isblank(b8) and isblank(c8) and isblank(d8) and isblank(c7)
put "O" into c7
exit function
end if
if isblank(b6) and isblank(c6) and isblank(d6) and b7="X" and isblank(d7) and
isblank(b8) and isblank(c8) and isblank(d8) and isblank(c7)
put "O" into c7
exit function
end if
if isblank(b6) and isblank(c6) and isblank(d6) and isblank(b7) and d7="X" and
isblank(b8) and isblank(c8) and isblank(d8) and isblank(c7)
put "O" into c7
exit function
end if
if isblank(b6) and isblank(c6) and isblank(d6) and isblank(b7) and isblank(d7) and
b8="X" and isblank(c8) and isblank(d8) and isblank(c7)
put "O" into c7
exit function
end if
if isblank(b6) and isblank(c6) and isblank(d6) and isblank(b7) and isblank(d7) and
isblank(b8) and c8="X" and isblank(d8) and isblank(c7)
put "O" into c7
exit function
end if
if isblank(b6) and isblank(c6) and isblank(d6) and isblank(b7) and isblank(d7) and
isblank(b8) and isblank(c8) and d8="X" and isblank(c7)
put "O" into c7
exit function
end if
if isblank(b6) and isblank(c6) and d6="X" and isblank(b7) and isblank(d7) and
isblank(b8) and isblank(c8) and isblank(d8) and isblank(c7)
put "O" into c7
exit function
end if
if isblank(b6) and isblank(c6) and isblank(d6) and isblank(b7) and isblank(d7) and
b8="X" and isblank(c8) and isblank(d8) and isblank(c7)
put "O" into c7
exit function
end if
if isblank(b6) and isblank(c6) and isblank(d6) and isblank(b7) and isblank(d7) and
isblank(b8) and isblank(c8) and d8="X" and isblank(c7)
put "O" into c7
exit function
end if
if isblank(b6) and c6="X" and isblank(d6) and isblank(b7) and isblank(d7) and
isblank(b8) and isblank(c8) and isblank(d8) and c7="O"
put "O" into d6
nmove = 1
exit function
end if
if isblank(b6) and isblank(c6) and isblank(d6) and isblank(b7) and d7="X" and
isblank(b8) and isblank(c8) and isblank(d8) and c7="O"
put "O" into d8
nmove = 1
exit function
end if
if isblank(b6) and isblank(c6) and isblank(d6) and isblank(b7) and isblank(d7) and
isblank(b8) and c8="X" and isblank(d8) and c7="O"
put "O" into b8
nmove = 1
exit function
end if
if isblank(b6) and isblank(c6) and isblank(d6) and b7="X" and isblank(d7) and
isblank(b8) and isblank(c8) and isblank(d8) and c7="O"
put "O" into b6
nmove = 1
exit function
end if
if b6="X" and isblank(c6) and isblank(d6) and isblank(b7) and isblank(d7) and
isblank(b8) and isblank(c8) and d8="X" and c7="O"
put "O" into b7
exit function
end if
if isblank(b6) and isblank(c6) and d6="X" and isblank(b7) and isblank(d7) and
b8="X" and isblank(c8) and isblank(d8) and c7="O"
put "O" into d7
exit function
end if
if b6="O"
if c6="O" and isblank(d6)
put "O" into d6
call ttt:win()
exit function
elseif isblank(c6) and d6="O"
put "O" into c6
call ttt:win()
exit function
elseif c7="O" and isblank(d8)
put "O" into d8
call ttt:win()
exit function
elseif isblank(c7) and d8="O"
put "O" into c7
call ttt:win()
exit function
elseif b7="O" and isblank(b8)
put "O" into b8
call ttt:win()
exit function
elseif isblank(b7) and b8="O"
put "O" into b7
call ttt:win()
exit function
end if
end if
if c6="O"
if c7="O" and isblank(c8)
put "O" into c8
call ttt:win()
exit function
elseif isblank(c7) and c8="O"
put "O" into c7
call ttt:win()
exit function
end if
end if
if d6="O"
if c7="O" and isblank(b8)
put "O" into b8
call ttt:win()
exit function
elseif isblank(c7) and b8="O"
put "O" into c7
call ttt:win()
exit function
elseif d7="O" and isblank(d8)
put "O" into d8
call ttt:win()
exit function
elseif isblank(d7) and d8="O"
put "O" into d7
call ttt:win()
exit function
elseif c6="O" and isblank(b6)
put "O" into b6
call ttt:win()
exit function
end if
end if
if b7="O"
if c7="O" and isblank(d7)
put "O" into d7
call ttt:win()
exit function
elseif isblank(c7) and d7="O"
put "O" into c7
call ttt:win()
exit function
end if
end if
if d7="O"
if c7="O" and isblank(b7)
put "O" into b7
call ttt:win()
exit function
end if
end if
if b8="O"
if c7="O" and isblank(d6)
put "O" into d6
call ttt:win()
exit function
elseif c8="O" and isblank(d8)
put "O" into d8
call ttt:win()
exit function
elseif isblank(c8) and d8="O"
put "O" into c8
call ttt:win()
exit function
elseif b7="O" and isblank(b6)
put "O" into b6
call ttt:win()
exit function
end if
end if
if c8="O"
if c7="O" and isblank(c6)
put "O" into c6
call ttt:win()
exit function
end if
end if
if d8="O"
if d7="O" and isblank(d6)
put "O" into d6
call ttt:win()
exit function
elseif c8="O" and isblank(b8)
put "O" into b8
call ttt:win()
exit function
elseif c7="O" and isblank(b6)
put "O" into b6
call ttt:win()
exit function
end if
end if
if b6 = "X"
if c6="X" and isblank(d6)
put "O" into d6
call ttt:win()
exit function
elseif isblank(c6) and d6="X"
put "O" into c6
call ttt:win()
exit function
elseif b7="X" and isblank(b8)
put "O" into b8
call ttt:win()
exit function
elseif isblank(b7) and b8="X"
put "O" into b7
call ttt:win()
exit function
elseif c7="X" and isblank(d8)
put "O" into d8
call ttt:win()
exit function
elseif isblank(c7) and d8="X"
put "O" into c7
call ttt:win()
exit function
end if
end if
if c6 = "X"
if isblank(c7) and c8="X"
put "O" into c7
call ttt:win()
exit function
elseif isblank(c8) and c7="X"
put "O" into c8
call ttt:win()
exit function
end if
end if
if d6="X"
if d7="X" and isblank(d8)
put "O" into d8
call ttt:win()
exit function
elseif isblank(d7) and d8="X"
put "O" into d7
call ttt:win()
exit function
elseif c7="X" and isblank(b8)
put "O" into b8
call ttt:win()
exit function
elseif isblank(c7) and b8="X"
put "O" into c7
call ttt:win()
exit function
elseif c6="X" and isblank(b6)
put "O" into b6
call ttt:win()
exit function
elseif isblank(c6) and b6="X"
put "O" into c6
call ttt:win()
exit function
end if
end if
if b7="X"
if c7="X" and isblank(d7)
put "O" into d7
call ttt:win()
exit function
elseif isblank(c7) and d7="X"
put "O" into c7
call ttt:win()
exit function
end if
end if
if d7="X"
if c7="X" and isblank(b7)
put "O" into b7
call ttt:win()
exit function
end if
end if
if b8="X"
if c8="X" and isblank(d8)
put "O" into d8
call ttt:win()
exit function
elseif isblank(c8) and d8="X"
put "O" into c8
call ttt:win()
exit function
elseif c7="X" and isblank(d6)
put "O" into d6
call ttt:win()
exit function
elseif b7="X" and isblank(b6)
put "O" into b6
call ttt:win()
exit function
elseif isblank(b7) and b6="X"
put "O" into b7
call ttt:win()
exit function
end if
end if
if c8="X"
if isblank(c6) and c7="X"
put "O" into c6
call ttt:win()
exit function
end if
end if
if d8="X"
if isblank(b6) and c7="X"
put "O" into b6
call ttt:win()
exit function
elseif d7="X" and isblank(d6)
put "O" into d6
call ttt:win()
exit function
elseif c8="X" and isblank(b8)
put "O" into b8
call ttt:win()
exit function
elseif isblank(c8) and b8="X"
put "O" into c8
call ttt:win()
exit function
end if
end if
rep = 0
repaint off
while won <> 1 or won <> 2
r = int(uniform(3)+6)
c = int(uniform(3)+2)
go to cell makecell(c,r)
if isblank(range(makecell(c,r)))
put "O" into makecell(c,r)
go to cell a1
unselect
repaint on
repaint range makecell(c,r)
rep = 0
call ttt:win()
exit while
else
call ttt:win()
if rep = 1
go to cell a1
repaint on
repaint window
end if
end if
end while
end if
end function
function frmt()
repaint off
select range b6..d8
text font "Helvetica"
text size 36
text style "Bious"
align center
unselect
repaint on
repaint range b6..d8
end function
function win()
unselect
if won=0
if (b6="X" and c6="X" and d6="X")
message "Congratulations! You won!"
won = 1
call ttt:clr()
call ttt:ywon()
elseif (b6="O" and c6="O" and d6="O")
message "Sorry, Wingz won. Try again!"
won = 1
call ttt:clr()
call ttt:wwon()
elseif (b7="X" and c7="X" and d7="X")
message "Congratulations! You won!"
won = 1
call ttt:clr()
call ttt:ywon()
elseif (b7="O" and c7="O" and d7="O")
message "Sorry, Wingz won. Try again!"
won = 1
call ttt:clr()
call ttt:wwon()
elseif (b8="X" and c8="X" and d8="X")
message "Congratulations! You won!"
won = 1
call ttt:clr()
call ttt:ywon()
elseif (b8="O" and c8="O" and d8="O")
message "Sorry, Wingz won. Try again!"
won = 1
call ttt:clr()
call ttt:wwon()
elseif (b6="X" and b7="X" and b8="X")
message "Congratulations! You won!"
won = 1
call ttt:clr()
call ttt:ywon()
elseif (b6="O" and b7="O" and b8="O")
message "Sorry, Wingz won. Try again!"
won = 1
call ttt:clr()
call ttt:wwon()
elseif (c6="X" and c7="X" and c8="X")
message "Congratulations! You won!"
won = 1
call ttt:clr()
call ttt:ywon()
elseif (c6="O" and c7="O" and c8="O")
message "Sorry, Wingz won. Try again!"
won = 1
call ttt:clr()
call ttt:wwon()
elseif (d6="X" and d7="X" and d8="X")
message "Congratulations! You won!"
won = 1
call ttt:clr()
call ttt:ywon()
elseif (d6="O" and d7="O" and d8="O")
message "Sorry, Wingz won. Try again!"
won = 1
call ttt:clr()
call ttt:wwon()
elseif (b6="X" and c7="X" and d8="X")
message "Congratulations! You won!"
won = 1
call ttt:clr()
call ttt:ywon()
elseif (b6="O" and c7="O" and d8="O")
message "Sorry, Wingz won. Try again!"
won = 1
call ttt:clr()
call ttt:wwon()
elseif (d6="X" and c7="X" and b8="X")
message "Congratulations! You won!"
won = 1
call ttt:clr()
call ttt:ywon()
elseif (d6="O" and c7="O" and b8="O")
message "Sorry, Wingz won. Try again!"
won = 1
call ttt:clr()
call ttt:wwon()
end if
if isblank(b6)=0 and isblank(b7)=0 and isblank(b8)=0 and isblank(c6)=0
and isblank(c7)=0 and isblank(c8)=0 and isblank(d6)=0 and isblank(d7)=0
and isblank(d8) = 0
message "Cat game. Play again."
call ttt:catwon()
won = 2
rep = 1
call ttt:clr()
end if
if won = 1 or won = 2
call ttt:frmt()
flag = 1
won = 0
end if
end if
end function
function clr()
repaint off
select range b6..d8
clear
unselect
repaint on
repaint range b6..d8
end function
function catwon()
define scr
scr = d2
scr = scr + 1
put scr into d2
end function
function ywon()
define scr
scr = b2
scr = scr + 1
put scr into b2
end function
function wwon()
define scr
scr = c2
scr = scr + 1
put scr into c2
end function